package com.example.wanandroid.mapper;

import com.example.wanandroid.pojo.Question;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface QuestionMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Question record);

    int insertSelective(Question record);

    Question selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Question record);

    int updateByPrimaryKey(Question record);

    @Select("SELECT id,userid,title,content,create_date AS createDate FROM tb_question WHERE userid = #{userid} ORDER BY id DESC limit #{start},#{pageSize}")
    List<Question> listMyQuestions(Long userid, int start, int pageSize);


    @Select("SELECT id,userid,title,content,create_date AS createDate FROM tb_question WHERE ORDER BY id DESC limit #{start},#{pageSize}")
    List<Question> listAllQuestions(int start, int pageSize);
}